package huriezy.quickcontacts.models.interfaces;

import java.util.Map;

import android.content.OperationApplicationException;
import android.os.RemoteException;

public interface IContactManager {

	public static final String	NAME_TAG			= "Name";
	public static final String	NUMBER_TAG			= "Number";
	public static final String	EMAIL_TAG			= "Email";
	public static final String	PICTURE_TAG			= "Picture";
	public static final String	ADDRESS_TAG			= "Address";

	public static final int		EXISTING_NUMBER		= 0;
	public static final int		EXISTING_NAME		= 1;
	public static final String	CONTACT_SEPARATOR	= ";";

	/**
	 * Get a type of data from the current saved contact.
	 * 
	 * @param key
	 * @return
	 */
	public String getContactData(String key);

	/**
	 * Put a type of data into the current saved contact.
	 * 
	 * @param key
	 * @param value
	 */
	public void putContactData(String key, String value);

	/**
	 * Add the current saved contact informations to the system contacts
	 * management. return true if the contact has been correctly created.
	 * 
	 * @throws RemoteException
	 * @throws OperationApplicationException
	 */
	public boolean addCurrentContact();

	/**
	 * Add the donate contact informations to the system contacts management. If
	 * this contact must replaced an existing contact, the id of this contact
	 * can be pass through this method to indicate the contact to replace.
	 * 
	 * @param contactInfos
	 * @throws RemoteException
	 * @throws OperationApplicationException
	 */
	public boolean addContact(Map<String, String> contactInfos, int userReplaced);

	/**
	 * Verify if all data are conform to create the contact.
	 * 
	 * @return true if conform, false otherwise.
	 */
	public boolean verifyCorrectContact();

	/**
	 * Verify in the list of current contact if the donate number is already
	 * used for an existing contact, and return its name if exists.
	 * 
	 * @param number
	 * @return
	 */
	public String getExistingContactIdByName(String number);

	/**
	 * Verify in the list of current contact if the donate contact name is
	 * already used for an existing contact, and return its number if exists.
	 * 
	 * @param number
	 * @return
	 */
	public String getExistingContactIdByNumber(String number);

	/**
	 * Search for a contact corresponding to the donate id and return a String
	 * formatted as "contactName:contactNumber"
	 * 
	 * @param id
	 * @return
	 */
	public String getContactById(String id);

	/**
	 * Replace an existing contact with the current informations saved in this
	 * manager.
	 * 
	 * @param type
	 * @param baseInfo
	 * @param existingInfo
	 * @throws OperationApplicationException
	 * @throws RemoteException
	 */
	public void replaceContact(String id);
}
